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