UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q6hpeXj0eUlVTNNVZxu6LXD1noyjYngNmxnIkaHPyMY='
WHERE
key_id = '8b04ccdb4b898bb5ec8656adb53d24f4728381fcc73fdc53e18bfffcf20fb418'
AND (
token = 'q6hpeXj0eUlVTNNVZxu6LXD1noyjYngNmxnIkaHPyMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)