UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5AYIaqOJvQicBqki7NANARhPqnmnm5nG71FIW1l8tGU=' 
WHERE 
  key_id = '87e3613001700ed807a65ad653ace198627d9e919898eaa33dff907d383b25bf' 
  AND (
    token = '5AYIaqOJvQicBqki7NANARhPqnmnm5nG71FIW1l8tGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00012