UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KKHJ3vW1V0EiGaEuMtJMivAseYNPqt+0tgPEAd6SLW8=' 
WHERE 
  key_id = '035e9c46f499902831addd457dfdab78ee5ed9ea8cfed98461b052b893a73b37' 
  AND (
    token = 'KKHJ3vW1V0EiGaEuMtJMivAseYNPqt+0tgPEAd6SLW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035