UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0G6o/PQgLztDRMJ84F9BtTzz+p1s5m53vxMtUUWgxHo='
WHERE
key_id = 'cfe78e7e58d60a49a42b874c6db7e4e3918ff4ea6ff8950b0d54c816f1d293ad'
AND (
token = '0G6o/PQgLztDRMJ84F9BtTzz+p1s5m53vxMtUUWgxHo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)