UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eoXpDxlLHkgeY6KvHs5kThbb/O/t4qANaygOFPy47Mw='
WHERE
key_id = '46faaa579f78ed1b493a1d0cbb25eb7e6b218e3fe4e27abad85d0b2be5a7721a'
AND (
token = 'eoXpDxlLHkgeY6KvHs5kThbb/O/t4qANaygOFPy47Mw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)