UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g+AU5EPxMVmTAUE0ht7jH3KuT95LJM0IDMVrVpdgJFs=' 
WHERE 
  key_id = '96d092a1166c63e8fc4ca715168927f73b7e508bf8f65b84f3d4640c868ea34a' 
  AND (
    token = 'g+AU5EPxMVmTAUE0ht7jH3KuT95LJM0IDMVrVpdgJFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034