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

Query time 0.00030