UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WrmmtEEU02FPBYXyELfUAOh3a987fYwOe52Tqc3mQzI=' 
WHERE 
  key_id = '67fee3620ce91571d5c6357e7e7e96535688cfa7f03c251d088beb7f2e57d725' 
  AND (
    token = 'WrmmtEEU02FPBYXyELfUAOh3a987fYwOe52Tqc3mQzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048