UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sCnAEFjwqT5J7JGlFN0sg8MGGucOZCdKXazZjBWOhvE=' 
WHERE 
  key_id = '4a9f510df01189a7052aae40c93aa64c234021ed65f866291994c32a54fe6b4c' 
  AND (
    token = 'sCnAEFjwqT5J7JGlFN0sg8MGGucOZCdKXazZjBWOhvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042