UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XJgYIxoR1in10Ysi7FtBKjVZOZhC7gLEVd/goyA11Zc='
WHERE
key_id = 'a15458f212224d83ac4535e4963ab8c7e67ab48118c2ce8d3c397f6a151779f6'
AND (
token = 'XJgYIxoR1in10Ysi7FtBKjVZOZhC7gLEVd/goyA11Zc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)