UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aKn0ALtOxF5cCp2aOeD/wu2+XXrkNlr9VanpPm309Oo='
WHERE
key_id = 'a82b3cb8a80bc34fe4573a4c2c2c8be1df763c56c5a1f50f9eda30ed1f68cc40'
AND (
token = 'aKn0ALtOxF5cCp2aOeD/wu2+XXrkNlr9VanpPm309Oo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)