UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cSDTMzPQsc4rvrOMKXSpige4/E26fLC+e+aSBdnjvsU='
WHERE
key_id = '2a7658e38c68410f85857fb7b4e72a764becfbbd39f124f884471f29ad670f8b'
AND (
token = 'cSDTMzPQsc4rvrOMKXSpige4/E26fLC+e+aSBdnjvsU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)