UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HOPeBacWF3G+RuG67Ns7uJe2VHZVuw8bxuGNgY9UmY4='
WHERE
key_id = '8d9f1fdd66afcfc9a28cbf4768650dd42bda0ccffdcaf8dcb9de2b5fd2ad37de'
AND (
token = 'HOPeBacWF3G+RuG67Ns7uJe2VHZVuw8bxuGNgY9UmY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)