UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J7kqt0pEK0nIbguRWn4+mFvhbtsCFeKZkJKkxerqxLo='
WHERE
key_id = 'e9b7bd3ec0d9d93a75050a001f22497cc9624b0f43be56aa55e15e4a46da3700'
AND (
token = 'J7kqt0pEK0nIbguRWn4+mFvhbtsCFeKZkJKkxerqxLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)