UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9afEYF1goPIFEsJlIWwOTsYO3Io5NsFThEHWMDAwTrs=' 
WHERE 
  key_id = '1f63f8718bf7111a471ff0bb356568fba025697080d45a2efc2907122a4cf24a' 
  AND (
    token = '9afEYF1goPIFEsJlIWwOTsYO3Io5NsFThEHWMDAwTrs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028