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