UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NUpY0ZZOZmqc5mKWFCK9jaUeE5JoGVxd1a4VEhXLLcI='
WHERE
key_id = '342af8c1e5ff6514c186ca53d2cf98a318af9194b1fed6e60ccdccd378dd098c'
AND (
token = 'NUpY0ZZOZmqc5mKWFCK9jaUeE5JoGVxd1a4VEhXLLcI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)