UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZmDzVo6jpYI4zMCfJw4jh9yWdLFM9QwKy+VHoXBfXWM=' 
WHERE 
  key_id = '2e7f0dfe4d822582a7c121db9b620c037d3b3fd6135b1123f68004f1c3da3b85' 
  AND (
    token = 'ZmDzVo6jpYI4zMCfJw4jh9yWdLFM9QwKy+VHoXBfXWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028