UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H5RF1HYx7T3zUCqmT4A4HfnBkSV/2rnjsEnnU8YUbCA=' 
WHERE 
  key_id = '586b5c036ad1b0dd2228a4d19ad57af38e01db25200a0a0519a4d314222e9907' 
  AND (
    token = 'H5RF1HYx7T3zUCqmT4A4HfnBkSV/2rnjsEnnU8YUbCA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065