UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hGTqKalALSS1c6U3WbMKAyAy3rVBoOzHdu+30rSriss=' 
WHERE 
  key_id = 'c311c010f3830fbdb5e41113108402427960fc2d594a3310ca5d6c60f73fda73' 
  AND (
    token = 'hGTqKalALSS1c6U3WbMKAyAy3rVBoOzHdu+30rSriss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025