UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iDxU1Nzv7D2b4viOWi3HYOANc6rpf0pCGrEKXyiX8/s='
WHERE
key_id = '7e3d48340ce94a926791241422e409cfb56794f7d1d4ade65957aa647c54c873'
AND (
token = 'iDxU1Nzv7D2b4viOWi3HYOANc6rpf0pCGrEKXyiX8/s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)