UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TosKJDQEXDjA4h2PYJ6FgVZk5y+O22xTPYm1+aXGgls='
WHERE
key_id = '63b358dcfac497fe779bcaf140b304dd1d5e9cb6f00d3a26dd245ca76c6f54ea'
AND (
token = 'TosKJDQEXDjA4h2PYJ6FgVZk5y+O22xTPYm1+aXGgls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)