UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a7p0GJuxdlVB4jPNF1QVTTioDhGQNsRSdKuAmFNEfi4='
WHERE
key_id = 'f62bb4f54c0e35570cce50b6c2eca6eae78fe465e436d164adcd889b78c451bb'
AND (
token = 'a7p0GJuxdlVB4jPNF1QVTTioDhGQNsRSdKuAmFNEfi4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)