UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pb7GnZN9gbUQFnJvvRtdSy7bc1QHVRoWlOjE6+suwn8='
WHERE
key_id = '8fd6a3f0ea607eda15c6b4e39204767e600cc1e7866971b79aedd7ddf02d7326'
AND (
token = 'pb7GnZN9gbUQFnJvvRtdSy7bc1QHVRoWlOjE6+suwn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)