UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XzUB54fc5e0vjaoCi0Bzfvuh/ibds3gOM377GlVgXFc=' 
WHERE 
  key_id = '14cb2ea650d6adc8d5c15a7b8f6e753e1a4474b881737f7e3f5fd8082583257c' 
  AND (
    token = 'XzUB54fc5e0vjaoCi0Bzfvuh/ibds3gOM377GlVgXFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034