UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aVyL444R4j5fzprgT/6NW2wMadHt3rDkzwWp6k4dg6s='
WHERE
key_id = 'f35476fd45ef24817985a85abe8f8b538a359bb3a368ee6ea9b8677c6c40f94b'
AND (
token = 'aVyL444R4j5fzprgT/6NW2wMadHt3rDkzwWp6k4dg6s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)