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