UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+BCY5KC/xOkvXlxogCEMN9WdiROAD27329WwiS2C4Y=' 
WHERE 
  key_id = 'd603dcba93c49966317b11ee470756f82c2b2bae27b300fcce53cfed624d0936' 
  AND (
    token = 'D+BCY5KC/xOkvXlxogCEMN9WdiROAD27329WwiS2C4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00158