UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+vSoWpvMlcaLe4AMRsFjLzNqF+bO+QikKaNlz2J7zt0='
WHERE
key_id = '5376bf9dd42924bb22435eaae175a3b1ce3bcfe5b32af89d243dca943355b8a5'
AND (
token = '+vSoWpvMlcaLe4AMRsFjLzNqF+bO+QikKaNlz2J7zt0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)