UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gB4SLioGILgSVKiyD8PNvngRXHcYoj2hESagBIIkIIM='
WHERE
key_id = 'b824ac3af46a1935f23cfe59f68f81cda704e0b790fc7118f44e476a73b4f4c8'
AND (
token = 'gB4SLioGILgSVKiyD8PNvngRXHcYoj2hESagBIIkIIM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)