UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '77gArD8HevtvLOle6wruUygIeHooZNWfPTJ6b36dYJc='
WHERE
key_id = '78a9187024658eb574f9db78a83ba7c3e8621caff0ea7a167231ec6725c89ee4'
AND (
token = '77gArD8HevtvLOle6wruUygIeHooZNWfPTJ6b36dYJc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)