UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9uybcNSVIao+toR0DJxzIrLuhto1UlcY/4/kBtgi8RE=' 
WHERE 
  key_id = 'f0c7f439293bfd602c1c5d417cc10930d66f5b6e78a8db3b06b61a80e79d8a1a' 
  AND (
    token = '9uybcNSVIao+toR0DJxzIrLuhto1UlcY/4/kBtgi8RE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025