UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'phTH0VJwdqiuczkfQeb/39a2z0VAtOMtmVNP1/wRUm0='
WHERE
key_id = 'd1eaac54ab7aa8b5d3c7908de97b878ae6e5b9b1ca0f115db0597397bc40234a'
AND (
token = 'phTH0VJwdqiuczkfQeb/39a2z0VAtOMtmVNP1/wRUm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)