UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ag23n0asn/x1mJ9u26gNbfxHalpRamdo8LveDNZAC4=' 
WHERE 
  key_id = 'f821acf70f4e0069049a387bb44d07b4611a045931653ad565dba7a9c5ac019f' 
  AND (
    token = '5ag23n0asn/x1mJ9u26gNbfxHalpRamdo8LveDNZAC4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029