UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Si05VCjj8vmmbZh6CV0CMZusOkw7M0xckMIcinrAFY=' 
WHERE 
  key_id = 'e7ea69f13f799add38e65fc01e2caf91cd1e586700cac409c1bca0df16d804f4' 
  AND (
    token = '7Si05VCjj8vmmbZh6CV0CMZusOkw7M0xckMIcinrAFY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036