UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QsyMyI1MgKbOiXrYh7wBLz+osds+O9hUuHE+T9qg4/k='
WHERE
key_id = 'c2ccca5c985e23511a9a3f611a2c54513caf8e8b28d5b66e6bc7b07414cb7f2e'
AND (
token = 'QsyMyI1MgKbOiXrYh7wBLz+osds+O9hUuHE+T9qg4/k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)