UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3GpDytV4c7gJNqlSqUd2roLmPlrdFS+ThP/85rYNS+U='
WHERE
key_id = '5d48593491da718212616dc850009d7dcfc27c02f9a3f22118ff83fb88671bfb'
AND (
token = '3GpDytV4c7gJNqlSqUd2roLmPlrdFS+ThP/85rYNS+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)