UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9U45ZAQ6Sv+xKcgNVlnP5J1G5pADHXjllSPYKx9ges4='
WHERE
key_id = '98169b610a370104ed83385af3a8a98fe6a897deb7bf36fe288e0a11650ca3aa'
AND (
token = '9U45ZAQ6Sv+xKcgNVlnP5J1G5pADHXjllSPYKx9ges4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)