UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bW55RwdgheRKjYwEmcO3AVrb2IJidSqyI3V9BjFm5Gg='
WHERE
key_id = 'c254a5bc7dcd290cc1b0a5d05e2e13c624da8b451a5e7e5d447d48411fff40f3'
AND (
token = 'bW55RwdgheRKjYwEmcO3AVrb2IJidSqyI3V9BjFm5Gg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)