UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zE9DWtQUN+T97ph3KbgomXWjDJ/Fvw48CCiLbg5aoZI='
WHERE
key_id = 'f04d5b31b55836b58c7bc03f520c9789f6bd97d075ccbcc1df81f66911c90814'
AND (
token = 'zE9DWtQUN+T97ph3KbgomXWjDJ/Fvw48CCiLbg5aoZI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)