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

Query time 0.00047