UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dyYWcb0hp9CD/WA0Prum9O32gtOGHiXxVkSmxUCAA5U='
WHERE
key_id = '8f9d26f840980d4b90bde2f71a4e4326067739b6ea0ef3ebda4a766a9811329d'
AND (
token = 'dyYWcb0hp9CD/WA0Prum9O32gtOGHiXxVkSmxUCAA5U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)