UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qsBScP7VrrmwTOhvoeJqcx1neXVI6dvhTnmnQsgsFNQ=' 
WHERE 
  key_id = 'd0fddeca98e82d68de57a6a302b9d3e6b4649dc914439a6c963fc6833b23634d' 
  AND (
    token = 'qsBScP7VrrmwTOhvoeJqcx1neXVI6dvhTnmnQsgsFNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037