UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+JnyhB23/GMmcS6e1CwRlrGFHMFiAvKfXzqfa8+MNU=' 
WHERE 
  key_id = '95a803d4731083981a52541d34426d0fcd50369854228183577406fbd706cd52' 
  AND (
    token = 'P+JnyhB23/GMmcS6e1CwRlrGFHMFiAvKfXzqfa8+MNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068