UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xw+sVIus9EGyIkePdEFW8H/AhZPyC7F19GATrxxnR40=' 
WHERE 
  key_id = '22f269634c9385b21af0614e803053903865c2ecc97930755d81f728b8aebd4f' 
  AND (
    token = 'xw+sVIus9EGyIkePdEFW8H/AhZPyC7F19GATrxxnR40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029