UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kGf7tbvXwHaflcFr2IZNB/7cZltveQE6hXN3LgEFd9k='
WHERE
key_id = 'c79b680ad25b563a135607a35f855738d5e06a3ccd01affbd4a2b5f23b62496f'
AND (
token = 'kGf7tbvXwHaflcFr2IZNB/7cZltveQE6hXN3LgEFd9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)