UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm7rc+iIamIKM2X+F0bRkBrGh3IKctRGpAyCptBxK0dk=' 
WHERE 
  key_id = 'b11d8b352bd87c64a406ffa4f8ba12a4baf249bfb9167b8a26323e1c87f8e62d' 
  AND (
    token = 'm7rc+iIamIKM2X+F0bRkBrGh3IKctRGpAyCptBxK0dk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026