UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CeDr3XD5k3NXpJSApWV+NGt0rzRbS3oXXepb6T583TE=' 
WHERE 
  key_id = '5f587519cbd2a05947110b328aa955d00aae875e6ff5c180729fa588ece16342' 
  AND (
    token = 'CeDr3XD5k3NXpJSApWV+NGt0rzRbS3oXXepb6T583TE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025