UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WddlRzM4htE/wMtiUcZgHKWz0OkLwlgeXwznNjQ+qr4='
WHERE
key_id = '5ada38b945ee2bed47e1f06292c35b5d6a765cd1dba9442820699a01a5002fc7'
AND (
token = 'WddlRzM4htE/wMtiUcZgHKWz0OkLwlgeXwznNjQ+qr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)