UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K1iGmQXIFyxlg0hVf9zjxUZBWb+I8S1HUGKpoPvLQpw='
WHERE
key_id = '8cd548bff53f5d92cb53f4b612f83ebe7275223fd73280ff58a70161e1bfcd5f'
AND (
token = 'K1iGmQXIFyxlg0hVf9zjxUZBWb+I8S1HUGKpoPvLQpw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)